<template>
  <div id="app" style="width: 100%; min-width: 1240px">
    <div style="width: 100%">
      <div class="header">
        <div class="logo">
          <img style="width: 60px" src="./assets/img/logo.jpg" alt />
          <div class="gongsi">
            <div style="color: #1169b3; font-size: 20px; font-weight: 800">
              河北特种设备监督检查研究院
            </div>
            <div>
              <span style="color: #1169b3; font-size: 14px">唐山分院</span
              ><span style="color: #1169b3; font-size: 12px"
                >（原唐山市特种设备监督检查研究院）</span
              >
            </div>
          </div>
        </div>
        <div style="height: 100%" class="menu" v-if="routerArr.length">
          <!-- <div
            @click="goPage('/')"
            :class="{
              menuItem: path === '/',
              menuItemed: path != '/'
            }"
            index="/"
          >
            首页
          </div> -->
          <router-link to="/">首页</router-link>
          <router-link
            v-for="(item, index) of routerArr"
            :key="index"
            :to="item.path"
            >{{ item.name }}</router-link
          >
          <router-link to="/tellme">意见反馈</router-link>

          <!-- <div
            @click="goPage(item.path)"
            :class="{
              menuItem: path === item.path,
              menuItemed: path !== item.path
            }"
            v-for="(item, index) of routerArr"
            :key="index"
            :index="`/${item.path}`"
          >
            {{ item.name }}
          </div> -->
          <!-- <div
            @click="goPage('/tellme')"
            :class="{
              menuItem: path === '/tellme',
              menuItemed: path !== '/tellme'
            }"
            index="/tellme"
          >
            意见反馈
          </div> -->
        </div>
      </div>
    </div>
    <div style="width: 100%">
      <!-- <keep-alive > -->
      <!-- <router-view :key="key" /> -->
      <router-view />
      <!-- </keep-alive> -->
    </div>
    <div class="footer" style="min-width 100%">
      <div class="footer-content">
        <div class="footerContentLeft">
          <div class="footerTitle">唐山特检</div>
          <div class="footContent">
            <span
              >地址：唐山市高新开发区大庆道37号，河北省特种设备监督检验研究院唐山分院</span
            >
          </div>
          <div class="footContent">
            <span>电话：0315-5770281；0315-5770283</span>
          </div>
          <div class="footContent">
            <span>邮箱：tstjs126@163.com</span>
          </div>
        </div>
        <div v-if="routerArr.length" class="footerContentRight">
          <div class="footRight">
            <div class="footerTitle">{{ routerArr[2].name }}</div>
            <div
              v-for="(item, index) of routerArr[2].subMenuList.slice(0, 4)"
              :key="index"
              class="footContent"
            >
              <span @click="goPage('/overview')">{{ item.name }}</span>
            </div>
            <!-- <div class="footContent">
              <span>电话：wuxi1234566</span>
            </div>
            <div class="footContent">
              <span>邮箱：wuxi1234566</span>
            </div> -->
          </div>
          <div class="footRight">
            <div class="footerTitle">联系我们</div>
            <div @click="goPage('/tellme')" class="footContent">
              <span>留言建议</span>
            </div>
            <div @click="goPage('/contact')" class="footContent">
              <span>联系方式</span>
            </div>
          </div>
        </div>
      </div>
      <!-- <div class="copyBottom">
        <span>tstjs126@163.com</span>
      </div> -->
    </div>
  </div>
</template>

<script>
import { setRoutes } from './utils/auth'

export default {
  data() {
    return {
      router: true,
      defaultActive: '/',
      isShow: true,
      routerArr: [],
      path: ''
    }
  },
  created() {
    // this.path = this.$route.path
    // this.$router.push(this.path)
    // window.console.log(this.$route)
  },

  mounted() {
    this.$http
      .get('/companyWeb/menu/listAll')
      .then((response) => {
        window.console.log(response.data.obj.data)
        this.routerArr = response.data.obj.data
        setRoutes(listAll.data.obj.data)

        //window.console.log(this.caseList);
        // this.loading = false
      })
      .catch(function (error) {
        window.console.log(error)
      })
  },
  methods: {
    goPage(item) {
      this.$router.push(item)
    }
  }
}
</script>

<style lang="scss">
* {
  padding: 0;
  margin: 0;
}
html,
body {
  height: 100%;
}
.gongsi {
  margin-left: 10px;
  font-size: 22px;
  font-weight: 800;
  color: #333;
}
#app {
  position: relative;
  overflow: hidden;
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  // color: #2c3e50;
}
#app {
  box-sizing: border-box;
}

.header a {
  display: block;
  height: 80px;
  width: 116px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  cursor: pointer;
  color: #000;
  text-decoration: none;
}
// .menuItem {

// }
// .menuItemed {
// }
.header a.router-link-exact-active {
  // color: #42b983;
  color: #fff;
  height: 80px;
  background: #0065a1;
  width: 120px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 2px 12px 0 #d1cece;
}
.header {
  padding: 0 20px;
  box-sizing: border-box;
  background: #ffffff;
  height: 80px;
  display: flex;
  justify-content: space-between;
  align-content: center;
  margin: 0 auto;
  //background-color: #fff;

  .logo {
    width: 400px;
    padding: 10px;
    display: flex;
    align-items: center;
    img {
      margin-left: 20px;
      width: 100%;
    }
  }
}
.menu {
  display: flex;
  align-items: center;
  justify-content: space-around;
  .menuItem {
    height: 100%;
    width: 100px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0065a1;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
  }
  .menuItemed {
    height: 100%;
    width: 120px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: 700;
  }
}

.footer {
  padding: 60px 160px 20px 160px;
  box-sizing: border-box;
  background: #f0f0f0;
  width: 100%;
  // color: #b8b8b8;
  color: #333;
  .footerTitle {
    color: #333;
    font-weight: 700;
    font-size: 16px;
  }
  .footContent {
    font-size: 12px;
    margin-top: 10px;
    cursor: pointer;
  }
  .footer-content {
    width: 1240px;
    display: flex;
  }
  .footerContentLeft {
    flex: 1;
  }
  .footerContentRight {
    display: flex;
    flex: 1;
    .footRight {
      flex: 1;
    }
  }
  .footerContentRight {
    display: flex;
    flex: 1;
  }
  .copyBottom {
    height: 30px;
    span {
      line-height: 30px;
    }
  }
}
</style>
